package com.zjj;

import org.apache.dubbo.config.annotation.Reference;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class DubboConsumerDemo  {

  //@Reference注解就是用于标记这个服务具体使用了生产者的哪个接口实现
    @Reference(version = "default",timeout = 100000000)
    private DemoService demoService;

    public static void main(String[] args) throws InterruptedException {
        ConfigurableApplicationContext context = SpringApplication.run(DubboConsumerDemo.class);
        DemoService demoService = context.getBean(DemoService.class);
        //等provider调用完了回调之后,这个方法才会给返回值结果.
        String rs = demoService.sayHello("周瑜",  new DemoServiceListenerImpl());
        System.out.println("4.rs:" + rs  + "   毫秒值是 :" + System.currentTimeMillis());
    }

}
